import {
    // action
    A_Tabs,
    // mutations
    M_Tabs,
    // getters
    G_Tabs

} from './type'

const state = {
    options: []
};

const actions = {
    [A_Tabs]({ commit }, data) {
        commit(M_Tabs, data);
    },

};

const mutations = {
    [M_Tabs](state, data) {
        state.options.push(data)
    }

};

const getters = {
    [G_Tabs](state) {
        let hash = {};
        state.options = state.options.reduce(function(item, next) {
            hash[next.name] ? '' : hash[next.name] = true && item.push(next);
            return item
        }, []);
        return state.options;
    },

};
export default {
    state,
    getters,
    actions,
    mutations
}